import { handleActions } from 'redux-actions'
import { success } from '../ui-components'
import util from '../util'

const init = {
  schedules:{

  },
  records: {},
  sourceUsers: {},
}

export default handleActions({
  'clear schedule': (state, { payload }) => ({
    ...init,
  }),
  'fetch schedule': (state, { payload }) => ({
    ...state,
    schedules: {
      ...state.schedules,
      ...payload
    }
  }),
  'fetch record': (state, { payload }) => ({
    ...state,
    records: {
      ...state.records,
      ...payload,
    }
  }),
  'fetch source users': (state, { payload }) => ({
    ...state,
    sourceUsers: {
      ...state.sourceUsers,
      ...payload,
    }
  }),
}, init)
